package com.dreamchaser.book.service.impl;

import com.dreamchaser.book.dao.UserDao;
import com.dreamchaser.book.dao.impl.UserDaoImpl;
import com.dreamchaser.book.entity.User;
import com.dreamchaser.book.service.UserService;
import com.dreamchaser.book.utils.JDBCUtil;

import java.sql.Connection;

/**
 * UserService接口的实现类
 * @author Dreamchaser
 */
public class UserServiceImpl implements UserService {
    UserDao userDao=new UserDaoImpl();
    @Override
    public User login(String account, String pwd) {
        User u=new User();
        u.setAccount(account);
        u.setPwd(pwd);
        Connection conn= JDBCUtil.getConnection();
        User result=userDao.selectUserByCondition(conn,u);
        JDBCUtil.release(conn);
        return result;
    }
}
